package com.ruoyi.pressure.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; //添加
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pressure.mapper.KyLaneDblcRealMapper;
import com.ruoyi.pressure.domain.KyLaneDblcReal;
import com.ruoyi.pressure.service.IKyLaneDblcRealService;

/**
 * 顶板离层测点实时信息数据项说明Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-06
 */
@Service
public class KyLaneDblcRealServiceImpl extends ServiceImpl<KyLaneDblcRealMapper, KyLaneDblcReal> implements IKyLaneDblcRealService //修改
{
    @Autowired
    private KyLaneDblcRealMapper kyLaneDblcRealMapper;

    /**
     * 查询顶板离层测点实时信息数据项说明
     * 
     * @param kyLaneDblcRealId 顶板离层测点实时信息数据项说明主键
     * @return 顶板离层测点实时信息数据项说明
     */
    @Override
    public KyLaneDblcReal selectKyLaneDblcRealByKyLaneDblcRealId(String kyLaneDblcRealId)
    {
        return kyLaneDblcRealMapper.selectKyLaneDblcRealByKyLaneDblcRealId(kyLaneDblcRealId);
    }

    /**
     * 查询顶板离层测点实时信息数据项说明列表
     * 
     * @param kyLaneDblcReal 顶板离层测点实时信息数据项说明
     * @return 顶板离层测点实时信息数据项说明
     */
    @Override
    public List<KyLaneDblcReal> selectKyLaneDblcRealList(KyLaneDblcReal kyLaneDblcReal)
    {
        return kyLaneDblcRealMapper.selectKyLaneDblcRealList(kyLaneDblcReal);
    }

    /**
     * 新增顶板离层测点实时信息数据项说明
     * 
     * @param kyLaneDblcReal 顶板离层测点实时信息数据项说明
     * @return 结果
     */
    @Override
    public int insertKyLaneDblcReal(KyLaneDblcReal kyLaneDblcReal)
    {
        return kyLaneDblcRealMapper.insertKyLaneDblcReal(kyLaneDblcReal);
    }

    /**
     * 修改顶板离层测点实时信息数据项说明
     * 
     * @param kyLaneDblcReal 顶板离层测点实时信息数据项说明
     * @return 结果
     */
    @Override
    public int updateKyLaneDblcReal(KyLaneDblcReal kyLaneDblcReal)
    {
        return kyLaneDblcRealMapper.updateKyLaneDblcReal(kyLaneDblcReal);
    }

    /**
     * 批量删除顶板离层测点实时信息数据项说明
     * 
     * @param kyLaneDblcRealIds 需要删除的顶板离层测点实时信息数据项说明主键
     * @return 结果
     */
    @Override
    public int deleteKyLaneDblcRealByKyLaneDblcRealIds(String[] kyLaneDblcRealIds)
    {
        return kyLaneDblcRealMapper.deleteKyLaneDblcRealByKyLaneDblcRealIds(kyLaneDblcRealIds);
    }

    /**
     * 删除顶板离层测点实时信息数据项说明信息
     * 
     * @param kyLaneDblcRealId 顶板离层测点实时信息数据项说明主键
     * @return 结果
     */
    @Override
    public int deleteKyLaneDblcRealByKyLaneDblcRealId(String kyLaneDblcRealId)
    {
        return kyLaneDblcRealMapper.deleteKyLaneDblcRealByKyLaneDblcRealId(kyLaneDblcRealId);
    }

    @Override
    public int getDbwy() {
        KyLaneDblcReal kyLaneDblcReal = new KyLaneDblcReal();
        kyLaneDblcReal.setSensorType("顶板离层位移");
        List<KyLaneDblcReal> kyLaneDblcReals = kyLaneDblcRealMapper.selectKyLaneDblcRealList(kyLaneDblcReal);
        int count = 0;
        for (KyLaneDblcReal laneDblcReal : kyLaneDblcReals) {
            if (Double.parseDouble(String.valueOf(laneDblcReal.getSjdMonitorValue())) > 0.3){
                count ++;
            }
        }
        return count;
    }

    @Override
    public KyLaneDblcReal selectLcssByMeasurementPointCode(String measurementPointCode) {
        return kyLaneDblcRealMapper.selectLcssByMeasurementPointCode(measurementPointCode);
    }
}
